package com.atguigu.controller;

import com.atguigu.client.OrderFeignClient;
import com.atguigu.entity.OrderInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;

@Controller
public class WebPaymentController {
    @Autowired
    private OrderFeignClient orderFeignClient;
    //下单成功够跳转支付页面
    @GetMapping("pay.html")
    public String payment(Model model, @RequestParam Long orderId){
        OrderInfo orderInfo = orderFeignClient.getOrderInfo(orderId);
        model.addAttribute("orderInfo",orderInfo);
        return "payment/pay";
    }
    //支付成功后跳转到支付成功的页面  同步通知
    @GetMapping("alipay/success.html")
    public String success(){
        return "payment/success";
    }

}
